//
// Created by Administrator on 2021/10/16.
//
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <climits>

using namespace std;

class Solution {
public:
    bool uniqueOccurrences(vector<int> &arr) {
        unordered_map<int, int> charCounter;
        unordered_map<int, int> timesCounter;
        for (auto &x: arr) {
            charCounter[x]++;
        }
        for (auto &x: charCounter) {
            ++timesCounter[x.second];
        }
        for (auto &x: timesCounter) {
            if (x.second != 1)
                return false;
        }
        return true;
    }
};

class Solution2 {
public:
    bool uniqueOccurrences(vector<int> &arr) {
        unordered_map<int, int> occur;
        for (const auto &x: arr) {
            occur[x]++;
        }
        unordered_set<int> times;
        for (const auto &x: occur) {
            times.insert(x.second);
        }
        return times.size() == occur.size();
    }
};

int main() {
    vector<int> array{1, 2, 2, 1, 1, 3};
    vector<int> array2{-3, 0, 1, -3, 1, 1, 1, -3, 10, 0};
    Solution solution;
    cout << solution.uniqueOccurrences(array2) << endl;
    return 0;
}
